import 'package:flutter/cupertino.dart';
import 'package:hitutor/Util/Global.dart';
import 'package:hitutor/Util/MyColor.dart';
import 'package:hitutor/Util/PageUtil.dart';
import 'package:hitutor/Widget/MyBgPage.dart';
import 'package:hitutor/Widget/MyButton.dart';
import 'package:hitutor/Widget/MyImage.dart';

import 'GroupClassPay.dart';

class GroupClassFirst extends StatefulWidget {
  dynamic data;
  Function() onFinish;

  GroupClassFirst(this.data, {required this.onFinish});

  @override
  State<StatefulWidget> createState() {
    return _GroupClassFirst();
  }
}

class _GroupClassFirst extends State<GroupClassFirst> {
  buyGroupClass() {
    PageUtil().open(context, GroupClassPay(widget.data, onFinish: widget.onFinish));
  }

  @override
  void deactivate() {
    super.deactivate();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
        margin: EdgeInsets.fromLTRB(16, 16, 16, 24),
        padding: EdgeInsets.fromLTRB(16, 16, 16, 16),
        decoration: Global.getWhiteBg_shadow(8, MyColor.DD),
        child: SingleChildScrollView(
            child: Column(children: [
          NetImage(widget.data["imageUrl"], height: 200, fit: BoxFit.cover),
          Container(height: 8),
          Row(children: [
            Text("月費　", style: TextStyle(fontSize: 18, color: MyColor.C7D, fontWeight: FontWeight.bold)),
            Text("${widget.data["price"]}元", style: TextStyle(fontSize: 18, color: MyColor.Red, fontWeight: FontWeight.bold)),
          ]),
          Container(height: 8),
          Text(widget.data["pageContextHtml"], style: TextStyle(fontSize: 13, color: MyColor.C7D, height: 1.5)),
          // HtmlWidget(widget.data["pageContextHtml"]),
          Button("購買團課",
              height: 32, width: 108, radius: 4, bgColor: MyColor.Green, margin: EdgeInsets.fromLTRB(0, 16, 0, 24), onTap: buyGroupClass)
        ])));
  }
}
